package sk.lieskove301.jianghongtiao.liaad.prisoner;

import java.util.EnumSet;
import org.jfree.experimental.chart.swt.demo.SWTMultipleAxisDemo1;
import org.jfree.experimental.chart.swt.demo.SWTPieChartDemo1;
import sk.lieskove301.jianghongtiao.liaad.prisoner.ga.crossover.DoublePointCrossover;
import sk.lieskove301.jianghongtiao.liaad.prisoner.ga.crossover.SinglePointCrossover;
import sk.lieskove301.jianghongtiao.liaad.prisoner.ga.mutation.RandomMutation;
import sk.lieskove301.jianghongtiao.liaad.prisoner.ga.selection.BestNSelection;
import sk.lieskove301.jianghongtiao.liaad.prisoner.ga.selection.RouletteWheelSelection;
import sk.lieskove301.jianghongtiao.liaad.prisoner.ga.selection.Selection;
import sk.lieskove301.jianghongtiao.liaad.prisoner.gene.GeneEnum;
import sk.lieskove301.jianghongtiao.liaad.prisoner.memory.ForgettingEnum;
import sk.lieskove301.jianghongtiao.liaad.prisoner.payoff.PayoffCartel;
import sk.lieskove301.jianghongtiao.liaad.prisoner.payoff.PayoffCooperateWin;
import sk.lieskove301.jianghongtiao.liaad.prisoner.memory.LearningMemory;
import sk.lieskove301.jianghongtiao.liaad.prisoner.memory.OneDayMemory;
import sk.lieskove301.jianghongtiao.liaad.prisoner.statistics.StatisticStore;
import sk.lieskove301.jianghongtiao.liaad.prisoner.statistics.TableStatistics;
import sk.lieskove301.jianghongtiao.liaad.prisoner.statistics.charts.BestAgentsBarChart;
import sk.lieskove301.jianghongtiao.liaad.prisoner.statistics.charts.PieAgentsChart;
import sk.lieskove301.jianghongtiao.liaad.prisoner.statistics.charts.SelectStat;
import sk.lieskove301.jianghongtiao.liaad.prisoner.statistics.charts.ScatterPlot;
import sk.lieskove301.jianghongtiao.liaad.prisoner.statistics.charts.ShowStatistics;
import sk.lieskove301.jianghongtiao.liaad.prisoner.strategy.DefaultStrategy;
import sk.lieskove301.jianghongtiao.liaad.prisoner.strategy.GeneticAlgorithmStrategy;
import sk.lieskove301.jianghongtiao.liaad.prisoner.strategy.Strategy;


/**
 * Date of create: May 15, 2011
 *
 * @author JiangHongTiao <jjurco.sk_gmail.com>
 * @version 2011.0515
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

//        System.out.println(Math.pow(0.5, 3));
//        if(true)return;
        Strategy strategy = new DefaultStrategy(80);
        strategy.setForgetting(new ForgettingEnum[]{ForgettingEnum.LearningMemory});
//        strategy.setForgetting(new OneDayMemory());
//        strategy.setForgetting(new RememberBetrayMemory());
//        
//        Selection selection = new BestNSelection();
//        selection.setAproxSelectionSize(0.25);
////        
//        Strategy strategy = new GeneticAlgorithmStrategy();
//        strategy.setForgetting(ForgettingEnum.values());
//        strategy.setCrossover(new SinglePointCrossover());
//        strategy.setMutation(new RandomMutation());
//        strategy.setSelection(selection);
//        strategy.setPossibleGenes(GeneEnum.values());
//        strategy.setPossibleGenes(new GeneEnum[]{GeneEnum.Betray, GeneEnum.Cooperate});
        
        
//        strategy.setPayoff(new PayoffCartel(1000, 0.1, 200));
        strategy.setPayoff(new PayoffCooperateWin());
        
        Arena a = new Arena();
        a.setStrategy(strategy);
        a.setNumberOfAgents(100);
        StatisticStore statistics = a.makeFight(15, 20);

        TableStatistics.printFinal(statistics);
        ShowStatistics.showAll(statistics);
    }

}
